{extend name="main/index" /}
{block name="main"}
<div class="main-content">
    <div class="breadcrumbs" id="breadcrumbs">
        <script type="text/javascript">
            try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
        </script>

        <ul class="breadcrumb">
            <li>
                <i class="icon-home home-icon"></i>
                <a href="#">Home</a>
            </li>

            <li>
                <a href="{:url('admin/material/index')}" >Tables</a>
            </li>
            <li class="active">详情信息</li>
        </ul><!-- .breadcrumb -->

        <div class="nav-search" id="nav-search">
            <form class="form-search">
                <span class="input-icon">
                    <input type="text" placeholder="Search ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />
                    <i class="icon-search nav-search-icon"></i>
                </span>
            </form>
        </div><!-- #nav-search -->
    </div>
    <div class="page-content">
        <div class="row">
        <div class="col-xs-2">
        </div>
            <div class="col-xs-8">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="table-responsive">
                            <form id="themeForm" method="post"  onsumbit ="return false" enctype="multipart/form-data" >
                                <div class="form-group">
                                    <label for="exampleInputEmail1">项目名称</label>
                                    <input type="hidden" class="form-control" id="exampleInputEmail1" name="id" value= "{$list['id']}" >
                                    <input type="text" class="form-control" id="exampleInputEmail1" value= "{$list['project_name']}" >
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">购货单位</label>
                                    <input type="text" class="form-control" id="exampleInputEmail1" name="purchasing_unit" placeholder="purchasing_unit" value="{$list['purchasing_unit']}">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">供货单位</label>
                                    <input type="text" class="form-control" id="exampleInputEmail1" name="supplier" placeholder="supplier" value="{$list['supplier']}">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">供货材料内容</label>
                                    <input type="text" class="form-control" id="exampleInputEmail1" name="material_content" placeholder="material_content" value="{$list['material_content']}" >
                                </div>

                                <div class="form-group">
                                    <label for="exampleInputPassword1">合同总价</label>
                                    <input type="text" class="form-control" id="exampleInputPassword1" name="contract_sum" placeholder="contract_sum" value="{$list['contract_sum']}" >
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputPassword1">付款方式</label>
                                    <input type="text" class="form-control" id="exampleInputPassword1" name="payment_method" placeholder="payment_method" value="{$list['payment_method']}">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputPassword1">签订时间</label>
                                    <input type="text" class="form-control" id="exampleInputPassword1" name="time" placeholder="time" value="{$list['time']}">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputPassword1">签订地点</label>
                                    <input type="text" class="form-control" id="exampleInputPassword1" name="address" placeholder="address" value="{$list['address']}">
                                </div>
                                  <div class="form-group">
                                  <button  class="btn btn-info up_btn" id="add_Material" >确认更改</button>
                                      <div class="col-xs-8">
                                      </div>
                                      <a href="{:url('admin/Contract/index')}" class="btn btn-info" id="aa" >返回上一级</a>

                                </div>
                            </form>
                        </div>
            </div>
            <div class="col-xs-3">
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div><!-- /.page-content -->
</div>




{/block}

            {block name="myjs"}
            <script>
            $('#add_Material').click(function(){
                id= $('input[name="id"]').val();
                upAjax(id);
            });

            function upAjax(id){
                $.ajax({
                    type:'post',
                    url: '/admin/Contract/updateMaterial/id/'+ id,
                    dataType:'json',
                    data: {
                        id:$('input[name="id"]').val(),
                        project_name:$('input[name="project_name"]').val(),
                        purchasing_unit:$('input[name="purchasing_unit"]').val(),
                        supplier:$('input[name="supplier"]').val(),
                        material_content:$('input[name="material_content"]').val(),
                        contract_sum:$('input[name="contract_sum"]').val(),

                        payment_method:$('input[name="payment_method"]').val(),

                        time:$('input[name="time').val(),
                        address:$('input[name="address"]').val()
                    },

                    success: function (data) {
                        console.log(data);
                        if (data.status) {
                            alert('成功');
                        } else {
                            alert('失败');
//                            toastr.error(data.info, 'FBI WARNING:');
                        }
                    },
                    error: function () {
                        alert('AJAX执行失败');
                    }
                });
            }

        </script>

        {/block}
